/*
 * @Description:部门的server
 * @Version: 2.0
 * @Autor: kafei
 * @Date: 2021-11-26 16:48:32
 * @LastEditors: kafei
 * @LastEditTime: 2021-12-07 17:46:30
 */
const execSQL = require('../db/connect')
const { createWhereSql } = require('../utils/sql')
async function getAllDepartMentServer() {
  const sql = `select * from de_department`
  const result = await execSQL(sql)
  return result
}
async function getUserByDeptIdServer(params) {
  const { userName, depId, status, telphone, createTime } = params
  const sqlParams = {
    userName,
    depId,
    telphone,
    status,
    createTime
  }
  const like = ['userName', 'telphone']
  const and = ['createTime']
  const sql = createWhereSql('dy_user', sqlParams, like, and)
  const result = await execSQL(sql)
  return result
}

module.exports = {
  getAllDepartMentServer,
  getUserByDeptIdServer
}
